package com.igeek.javase.ch02;

import java.util.Scanner;
/*
 *@author wangpeng
 *2023/7/11 16:10
 *@description TODO
 */

public class SwitchTest1 {
    public static void main(String[] args) {
        Scanner data = new Scanner(System.in);
        System.out.print("请输入该学生成绩(成绩范围0~100)：");
        int grade = data.nextInt();//定义grade且获取键盘输入的整数
        if (grade < 0 || grade > 100) {//输入的整数范围应为0-100
            System.out.println("输入的成绩范围有误！");
            return;
        }
        switch (grade / 10) {
            case 10:
            case 9:
                System.out.println("该学生成绩为A级!");
                break;
            case 8:
                System.out.println("该学生成绩为B级!");
                break;
            case 7:
                System.out.println("该学生成绩为C级!");
                break;
            case 6:
                System.out.println("该学生成绩为D级!");
                break;
            default:
                System.out.println("该学生成绩不合格!");
        }
    }
}
